home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 23 / AACD 23.iso / AACD / Online / FlushHeaders / old-source / OldSource.lha / yam2nn.h < prev   
C/C++ Source or Header  |  1999-06-14  |  6KB  |  200 lines

  1. /*
  2. **   YAM2NN - Usenet access for YAM p7 and newer
  3. **   Copyright (C) 1999 Karol Bryd <kbryd@femina.com.pl>
  4. **
  5. **   This program is free software; you can redistribute it and/or
  6. **   modify it under the terms of the GNU General Public License
  7. **   as published by the Free Software Foundation; either version 2
  8. **   of the License, or (at your option) any later version.
  9. **
  10. **   This program is distributed in the hope that it will be useful,
  11. **   but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. **   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. **   GNU General Public License for more details.
  14. **
  15. **   You should have received a copy of the GNU General Public License
  16. **   along with this program; if not, write to the Free Software
  17. **   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. */
  19.  
  20. #include "compiler.h"
  21.  
  22. #include <stdio.h>
  23. #include <stdlib.h>
  24. #include <string.h>
  25. #include <ctype.h>
  26. #include <time.h>
  27.  
  28. #include <exec/types.h>
  29. #include <exec/lists.h>
  30. #include <exec/nodes.h>
  31. #include <exec/memory.h>
  32. #include <dos/var.h>
  33. #include <dos/dos.h>
  34. #include <dos/datetime.h>
  35.  
  36. #include <devices/timer.h>
  37.  
  38. #include <libraries/asl.h>
  39. #include <libraries/mui.h>
  40. #include <libraries/reqtools.h>
  41. #include <utility/tagitem.h>
  42. #include <MUI/NList_mcc.h>
  43. #include <MUI/NListview_mcc.h>
  44. #include <MUI/Busy_mcc.h>
  45.  
  46. #include <sys/types.h>
  47. #include <netinet/in.h>
  48.  
  49. #include <proto/locale.h>
  50. #include <proto/intuition.h>
  51. #include <proto/graphics.h>
  52. #include <proto/exec.h>
  53. #include <proto/utility.h>
  54. #include <proto/dos.h>
  55. #include <proto/rexxsyslib.h>
  56. #include <proto/timer.h>
  57.  
  58. #ifdef __SASC
  59. #include <proto/socket.h>
  60. #include <proto/muimaster.h>
  61. #include <proto/reqtools.h>
  62. #endif
  63.  
  64. #include <rexx/rxslib.h>
  65. #include <rexx/rexxio.h>
  66. #include <rexx/errors.h>
  67.  
  68. #include "killfile.h"
  69. #include "get_folder_path.h"
  70. #include "config.h"
  71.  
  72. #define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
  73.  
  74. #define ID_SKIPALL 1
  75. #define ID_PERFORM 2
  76.  
  77. #define ALWAYS 0
  78. #define NEVER 1
  79. #define SKIPPED 2
  80.  
  81. #define STATUS_ACTIVE 1
  82. #define STATUS_INACTIVE 2
  83.  
  84. struct NewsMessage
  85. {
  86.     struct NewsMessage *next;  // pionter for next message
  87.     struct NewsMessage *prev;
  88.     struct List        *list;  // list of nodes with message's content
  89.     struct Article     *art;   // pointer for structure Article (described later)
  90.  
  91.     char   *FullName;          // full name of file to which message will be written
  92.     char   *MsgID;             // message id of message
  93.     long   length;             // length of message
  94.  
  95.     struct timeval start;      // start time
  96.     struct timeval end;        // end time
  97. };
  98.  
  99.  
  100. struct NewsNode
  101. {
  102.     struct NewsNode *next;
  103.     struct NewsNode *prev;
  104.     struct List     *mesg;    // list of downloaded messages
  105.     char  *ngname;             // newsgroup name
  106.     char  *path;               // path to a folder with messages
  107.     char  *host;               // server name
  108.     char  *last_id;            // MessageID of last downloaded message
  109.     int    port;                // port number
  110.     int    sd;                  // file descriptor
  111.     long   last;                // last downloaded message
  112.     long   last_pos;            // position of last dn message in the MUI list
  113.     long   maxlen;              // maximum length of a message we can d/n
  114.     long   maxmsg;              // maximum number of messages
  115.     long   initfetch;           // initial fetch - how many fetch for the first time
  116.     long   flushthreshold;
  117.     long   preselect_type;
  118.     char   folder[80];          // folder name
  119.     char   update;              // do we need to update folders?
  120.     long   status;              // status: active or inactive
  121.  
  122. // added on 17-apr-99
  123.  
  124.     long total_size;          // length of all articles to download from this ng
  125.     long size_downloaded;     // length of all downloaded articles
  126.     long num_articles;        // number of articles to download
  127.     long art_downloaded;      // number of downloaded articles
  128. };
  129.  
  130. // holds informations about one article on the server
  131.  
  132. struct Article
  133. {
  134.     long Num;                 // article number
  135.  
  136.     char *Subject;            // subject
  137.     char *From;               // from
  138.     char *Date;
  139.     char *Msg_ID;
  140.     char *References;
  141.     char *Xref;
  142.  
  143.     char  FileName[20];        // file name, for example 07234.012
  144.     char  FullName[108];       // file name with path
  145.     char *MessageID;       // Message-ID field extracted from the message
  146.     long  Size;                // message size
  147.     long  Lines;               // number of lines
  148.     char  Status;              // status, skip or get
  149.     char  Importance;          // currently not used
  150.     int   Score;               // score
  151. };
  152.  
  153. extern APTR initmui(void);
  154. extern void setmui(struct NewsNode *nn);
  155. extern void fail(char *str, int ret);
  156. extern int do_connect(char *host, int port);
  157. extern int ngets(char *p, int fd);
  158. extern int nwrite(int socket, char *s);
  159. extern void updategadgets(int type);
  160.  
  161. extern struct timerequest *create_timer(ULONG unit);
  162. extern void delete_timer(struct timerequest *tr);
  163.  
  164. extern struct ReqToolsBase   *ReqToolsBase;
  165. extern struct IntuitionBase  *IntuitionBase;
  166.  
  167. #ifndef __GNUC__
  168. extern struct Library        *RexxSysBase;
  169. extern struct Library        *LocaleBase;
  170. extern struct Library        *TimerBase;
  171. #else
  172. extern struct RxsLib         *RexxSysBase;
  173. extern struct LocaleBase     *LocaleBase;
  174. extern struct Device         *TimerBase;
  175. #endif
  176.  
  177. extern struct timerequest    *tr;
  178.  
  179. extern struct Library        *SocketBase;
  180. extern struct Library        *MUIMasterBase;
  181. extern struct Library        *MiamiBase;
  182.  
  183. extern struct List           *newsgroupslist;
  184. extern struct List           *folders;
  185. extern struct MsgPort        *port, *ARexxPort;
  186.  
  187. extern APTR app;
  188.  
  189. #ifndef __SASC
  190. extern char *Stptok(const char *s, char *tok, int toklen, const char *brk);
  191. extern char *Stpblk(const char *str);
  192. extern int Astcsma(char *s, char *p);
  193.  
  194. #define stpblk Stpblk
  195. #define stptok Stptok
  196. #define astcsma Astcsma
  197.  
  198. #endif
  199.  
  200.